home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- function doexplode()
- {
- myColor.setTransform(myColorNormal);
- this.gotoAndStop("death");
- }
- function dorespawn()
- {
- currentdamage = 0;
- hitted = false;
- flashing = false;
- timerdamage = 0;
- death = false;
- dx = SPEED;
- this.gotoAndStop("standing");
- }
- function drawframe()
- {
- if(dx < 0)
- {
- forward = true;
- }
- else
- {
- forward = false;
- }
- if(lastX != _X)
- {
- !forward ? (_xscale = Math.abs(_xscale)) : (_xscale = Math.abs(_xscale) * -1);
- }
- }
- xi -= _parent.heroe.scrollspeed;
- _X = _X - (dx + _parent.heroe.scrollspeed);
- _Y = _Y - heroe.vscrollspeed;
- if(Math.abs(_X - xi) >= delta)
- {
- dx *= -1;
- }
- hitable = this.hitTest(_parent.mascara);
- if(hitable)
- {
- _visible = true;
- if(!death)
- {
- if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
- {
- heroe.damage = 2;
- heroe.hitted = true;
- }
- if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
- {
- hitted = true;
- _root.shoot1.impact = true;
- _root.hitted.start();
- }
- if(timerdamage == 0 && hitted)
- {
- timerdamage = FLASHTIME;
- currentdamage += DAMAGE;
- }
- if(timerdamage > 0)
- {
- flashing = true;
- timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
- timerdamage--;
- }
- if(flashing && timerdamage == 0)
- {
- flashing = false;
- myColor.setTransform(myColorNormal);
- hitted = false;
- }
- if(currentdamage >= MAXDAMAGE)
- {
- myColor.setTransform(myColorTransform);
- _root.bevil.gotoAndStop(MAXDAMAGE);
- death = true;
- }
- if(death)
- {
- _root.shoot1.impact = false;
- _root.bigexp.play();
- dx = 0;
- }
- drawframe();
- }
- else
- {
- doexplode();
- }
- }
- else
- {
- _visible = false;
- if(death && Math.abs(heroe._x - _X) >= 200)
- {
- dorespawn();
- }
- }
- }
-